package cn.shenshen.shop.mapper;

import org.apache.ibatis.annotations.Param;

import java.util.List;

public class GoodQueryProvider {
    public String queryByIds(@Param("ids") List<Long> ids) {
        StringBuilder builder = new StringBuilder();
        builder.append("select * from t_goods ");
        if (ids.size() > 0) {
            builder.append("where id in (");
        }
        for (int i = 0; i < ids.size(); i++) {
            builder.append(ids.get(i)).append(",");
        }
        builder.deleteCharAt(builder.length() - 1).append(")");
        //返回sql语句
        return builder.toString();
    }
}